<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

// 路由都没有找到，执行此路由
Route::miss(function () {
    return '404 Not Found!';
});

// 公共接口，无需登录的组
Route::group('common', function () {
    // 注册
    Route::post('register', 'api.Login/register');
    // 发送短信验证码
    Route::post('sendSmsCode', 'api.Login/sendSmsCode');
    // 登录
    Route::post('login', 'api.Login/login');
});

// 用户相关
Route::group('user', function () {
    // 上传图片
    Route::post('uploadImage', 'api.Upload/uploadImage');
    // 获取用户信息
    Route::get('getUserInfo', 'api.User/getUserInfo');
    // 修改用户信息
    Route::post('editUserInfo', 'api.User/editUserInfo');
})->middleware(\app\moddleware\api\CheckToken::class);

// 商品相关
Route::group('goods', function () {
    // 获取商品列表
    Route::get('getGoodsList', 'api.Goods/getGoodsList');
    // 获取商品详情
    Route::get('getGoodsInfo', 'api.Goods/getGoodsInfo');
});

// 订单相关
Route::group('order', function () {
    // 支付订单
    Route::post('payOrder', 'api.Order/payOrder');
    // 创建订单
    Route::post('createOrder', 'api.Order/createOrder');
    // 评价订单
    Route::post('commentOrder', 'api.Order/commentOrder');
})->middleware(\app\moddleware\api\CheckToken::class);

Route::get('test', 'api.User/test');

